package com.leo.version5;

import javafx.application.Application;
import javafx.embed.swing.SwingNode;
import javafx.scene.Scene;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
import org.apache.batik.swing.JSVGCanvas;

import javax.swing.*;
import java.awt.*;
import java.net.URL;

/**
 * @ClassName SVGAnalysisFXDemo
 * @Description
 * @Author wangss
 * @date 2020.11.17 22:22
 * @Version 1.0
 */
public class SVGAnalysisFXDemo extends Application {

    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) throws Exception {
        AnchorPane root = new AnchorPane();
        Scene scene = new Scene(root);
        primaryStage.setScene(scene);
        primaryStage.setWidth(1000);
        primaryStage.setHeight(600);
        primaryStage.centerOnScreen();
        primaryStage.setTitle("字体图标使用");
        primaryStage.show();

        URL url = this.getClass().getClassLoader().getResource("font5/500px.svg");
        JSVGCanvas svgCanvas = new JSVGCanvas();
        svgCanvas.setURI(url.toURI().toString());

        FlowLayout flowLayout = new FlowLayout();
        JPanel panel = new JPanel(flowLayout);
        panel.add(svgCanvas);


        SwingNode swingNode = new SwingNode();
        swingNode.setContent(panel);

        root.getChildren().add(swingNode);
    }
}
